import axios from 'axios'
import { networkConfig } from '@/config/networkConfig'

const instance = axios.create({
    baseURL: networkConfig.serverUrl,
    timeout: networkConfig.requestTimeout
  })

instance.interceptors.request.use(config => { // config是请求
    return config// 加上token再把请求return出去
  }, e => Promise.reject(e))

  instance.interceptors.response.use(res => res.data, e => {
    return Promise.reject(e)
  })

  export default instance